package com.zegome.game.gomestory.main.helper;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.ParticleEffect;
import com.badlogic.gdx.graphics.g2d.ParticleEmitter;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.utils.BaseDrawable;
import com.badlogic.gdx.utils.Array;
import com.zegome.game.gomestory.main.G;

public class ParticalDrawable extends BaseDrawable{

	float delta;
	ParticleEffect effect;
	int emitterIndex;
	Array<ParticleEmitter> emitters;
	int particleCount = 10;
	
	public ParticalDrawable(int x, int y){
		effect = new ParticleEffect();
		effect.load(Gdx.files.internal("data/starParticle"), Gdx.files.internal("data"));
		effect.setPosition(x, y);
		// Of course, a ParticleEffect is normally just used, without messing around with its emitters.
		emitters = new Array(effect.getEmitters());
		effect.getEmitters().clear();
		effect.getEmitters().add(emitters.get(0));	
		effect.reset();		
	}

	public void act(float delta)
	{	
		this.delta = delta;
	}


	@Override
	public void draw(SpriteBatch batch, float x, float y, float width, float height)
	{
		effect.draw(batch, delta);
	}
}
